﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinQ_DTO;

namespace DAO
{
    public class PersonalizationAllUsersDAO
    {
        public List<aspnet_PersonalizationAllUser> LayDanhSachPersonalizationAllUser()
        {
            EFashionDBDataContext EFashionDB = new EFashionDBDataContext();
            var pau = from c in EFashionDB.aspnet_PersonalizationAllUsers select c;
            return pau.ToList();
        }

        public aspnet_PersonalizationAllUser LayPersonalizationAllUserTheoPathID(Guid pathID)
        {
            EFashionDBDataContext EFashionDB = new EFashionDBDataContext();
            aspnet_PersonalizationAllUser pau = EFashionDB.aspnet_PersonalizationAllUsers.Single(c => c.PathId == pathID);
            return pau;
        }

        public void XoaPersonalizationAllUser(Guid pathID)
        {
            EFashionDBDataContext EFashionDB = new EFashionDBDataContext();
            var pau = (from c in EFashionDB.aspnet_PersonalizationAllUsers
                                where c.PathId == pathID
                                select c);
            EFashionDB.aspnet_PersonalizationAllUsers.DeleteAllOnSubmit(pau);
            EFashionDB.SubmitChanges();
        }

        public void CapNhatPersonalizationAllUser(aspnet_PersonalizationAllUser pauLinq)
        {
            EFashionDBDataContext EFashionDB = new EFashionDBDataContext();
            aspnet_PersonalizationAllUser pau = EFashionDB.aspnet_PersonalizationAllUsers.Single(c => c.PathId == pauLinq.PathId);
            pau.PageSettings = pauLinq.PageSettings;
            pau.LastUpdatedDate = pauLinq.LastUpdatedDate;

            EFashionDB.SubmitChanges();
        }

        public void ThemPersonalizationAllUser(aspnet_PersonalizationAllUser pauLinq)
        {
            EFashionDBDataContext EFashionDB = new EFashionDBDataContext();
            EFashionDB.aspnet_PersonalizationAllUsers.InsertOnSubmit(pauLinq);

            EFashionDB.SubmitChanges();
        }


    }
}
